package com.registration.service;

import com.registration.bean.DoctorBean;
import com.registration.mapper.DoctorMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

@Service
public class DoctorServiceImpl implements DoctorService {

    @Autowired
    private DoctorMapper doctorMapper;

    @Override
    public List<DoctorBean> getDoctorsByDeptId(Integer deptId) {
        if (deptId == null) {
            return Collections.emptyList();

        }
        return doctorMapper.selectDoctorsByDeptId(deptId);
    }

    @Override
    public DoctorBean getDoctorById(Integer doctorId) {
        if (doctorId == null) {
            return null;
        }
        return doctorMapper.selectDoctorById(doctorId);
    }
}
